<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<input type="text" id="content">
<button id="btn">button</button>

<script>
    $("#btn").on("click",function () {
        var val = $("#content").val();
        if(val == "" || $.trim(val).length == 0){
            alert("不能为空！");
        }
    });
</script>
</body>
</html>